/**
 * 
 */
package org.swing.utility.jai.bean;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.HashSet;
import java.util.Set;
/**
 * @author Quynh Nhu
 *
 */
public class Camera {
	  private String id;

	  private String make;

	  private String model;

	  private Set photoSets = new HashSet();

	  private PropertyChangeSupport notifier = new PropertyChangeSupport(this);

	  public Camera() {
	  }

	  public Camera(final String make, final String model) {
	    this.make = make;
	    this.model = model;
	  }

	  public synchronized void addPropertyChangeListener(
	    final PropertyChangeListener listener) {
	    notifier.addPropertyChangeListener(listener);
	  }

	  public synchronized void addPropertyChangeListener(final String propertyName,
	    final PropertyChangeListener listener) {
	    notifier.addPropertyChangeListener(propertyName, listener);
	  }

	  public synchronized void removePropertyChangeListener(
	    final PropertyChangeListener listener) {
	    notifier.removePropertyChangeListener(listener);
	  }

	  public synchronized void removePropertyChangeListener(
	    final String propertyName, final PropertyChangeListener listener) {
	    notifier.removePropertyChangeListener(propertyName, listener);
	  }

	  public void addPhotoSet(final PhotoSet photoSet) {
	    photoSet.setCamera(this);
	    photoSets.add(photoSet);
	  }

	  public String getId() {
	    return id;
	  }

	  public String getMake() {
	    return make;
	  }

	  public String getModel() {
	    return model;
	  }

	  public Set getPhotoSets() {
	    return photoSets;
	  }

	  private void setId(final String id) {
	    String oldValue = this.id;
	    this.id = id;
	    notifier.firePropertyChange("id", oldValue, id);
	  }

	  public void setMake(final String make) {
	    String oldValue = this.make;
	    this.make = make;
	    notifier.firePropertyChange("make", oldValue, make);
	  }

	  public void setModel(final String model) {
	    String oldValue = this.model;
	    this.model = model;
	    notifier.firePropertyChange("model", oldValue, model);
	  }

	  private void setPhotoSets(final Set photoSets) {
	    this.photoSets = photoSets;
	  }
	}